home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume89
/
dos
/
bindnams.1
next >
Wrap
Text File
|
1989-03-16
|
29KB
|
700 lines
Path: xanth!ukma!mailrus!bbn!ulowell!page
From: page@swan.ulowell.edu (Bob Page)
Newsgroups: comp.sources.amiga
Subject: v89i079: bindnames - intelligent logical name assignment
Message-ID: <12302@swan.ulowell.edu>
Date: 16 Mar 89 20:47:40 GMT
Organization: University of Lowell, Computer Science Dept.
Lines: 689
Approved: page@swan.ulowell.edu
Submitted-by: cbmvax!daveh (Dave Haynie)
Posting-number: Volume 89, Issue 79
Archive-name: dos/bindnames.1
Here's a program I whipped up to more intelligently handle logical
name assignments in a Startup-Sequence. It reads all the files from
the "SYS:Names" directory, each of which has one or more lines logical
to physical assignments. It sorts them according to dependencies,
then makes all the name assignments. This managed to get every single
"Assign" command out of my Startup-Sequence, and it makes adding new
names a simple matter of dropping a new "names" file into SYS:Names.
This compiles under Lattice C V5.02 (binary included), and is fully
public domain.
[uuencoded executable included. ..Bob]
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# BindNames.c
# BindNames.uu
# Makefile
# ReadMe
# This archive created: Thu Mar 16 15:43:50 1989
cat << \SHAR_EOF > BindNames.c
/* ====================================================================== */
/* BindNames.c by Dave Haynie
This is a simple utility to remove some of the drudgery of program
installation. Instead of having to edit a Startup-Sequence for
every logical name that must be used by a new program, this lets
names be block-allocated. The BindNames program looks for files
in the SYS:Names directory. Each of these files contains any number
of lines of the form:
Name: Path
Where "Name" is the logical name we're assigning, "Path" is the
path name we're making equivalent.
*/
#include <exec/types.h>
#include <exec/memory.h>
#include <libraries/dos.h>
#include <libraries/dosextens.h>
#include <proto/all.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
/* ====================================================================== */
/* Macros */
#define CADDR(x) ((BPTR)(((ULONG)x)>>2))
#define NAMEDIR "SYS:Names"
#define CopyStr(s) strcpy(malloc(strlen(s)+1),s)
#define FreeStr(s) free(s)
/* The "-rr" option doesn't like NewList, bit it's real simple. WHEN can
we have inline functions.... */
#define NewList(l) { (l)->lh_Head = (struct Node *)&(l)->lh_Tail; \
(l)->lh_TailPred = (struct Node *)&(l)->lh_Head; \
(l)->lh_Tail = NULL; \
}
/* ====================================================================== */
/* Global variables */
extern struct DosLibrary *DosBase = NULL;
struct DosInfo *info = NULL;
struct DeviceList *lastdev;
BPTR namelock = NULL;
BOOL verbose = FALSE;
BOOL test = FALSE;
struct FileInfoBlock *fileinfo = NULL;
/* ====================================================================== */
/* This function makes a BCPL string into a C style string. */
char *b2cstr(char *cstr, BPTR bptr) {
char *ptr = (char *)BADDR(bptr);
strncpy(cstr,ptr+1,*ptr);
cstr[*ptr] = '\0';
return cstr;
}
/* This function allocates things in a DOS friendly way. */
void *DOSAlloc(LONG size) {
LONG *ptr = AllocMem(size+4,MEMF_PUBLIC|MEMF_CLEAR);
*ptr = size+4;
return ptr+1;
}
/* This function frees memory in a DOS friendly way. */
void DOSFree(void *mem) {
LONG *ptr = (LONG *)mem;
FreeMem(ptr-1,*(ptr-1));
}
/* ====================================================================== */
/* Here we manage name trees. Name nodes are built from the device list
first. All primary nodes based on the device list have NULL paths,
indicating that they are primary and thus, don't need to be recreated.
Subsequent nodes are added to the node that they depend on. If a node
is encountered that doesn't have a parent listed yet, it will be place
on a temporary node list. */
struct NameNode {
struct Node node;
struct NameNode *parent;
struct List children;
char *path;
};
struct List Names;
struct NameNode *lostnodes;
/* This function creates a name node, allocating whatever memory is
needed. */
struct NameNode *MakeNode(char *name, char *path) {
struct NameNode *nn;
if (!(nn = calloc(1,sizeof(struct NameNode)))) return NULL;
if (name) nn->node.ln_Name = CopyStr(name);
NewList(&nn->children);
if (path) nn->path = CopyStr(path);
return nn;
}
/* This function finds a particular name in the Names data base, via a
depth-first search. If it finds the name, it returns that node,
otherwise, it returns NULL. */
struct NameNode *FindNode(struct List *lst,char *name) {
struct Node *n;
struct NameNode *nn;
for (n = lst->lh_Head; n->ln_Succ; n = n->ln_Succ) {
if (!(stricmp(name,n->ln_Name))) return (struct NameNode *)n;
if (nn = FindNode(&((struct NameNode *)n)->children,name)) return nn;
}
return NULL;
}
/* This is the node assignment routine. It accepts a node name and a path
for assignment. It handles all the proper node creations to add that
information to the node data base. */
void DefNode(char *name, char *path) {
struct NameNode *nn, *parent;
char pardev[64];
int i;
for (i = 0; path[i] != ':' && i < 63; ++i) pardev[i] = path[i];
pardev[i] = '\0';
if (!(parent = FindNode(&Names,pardev))) {
AddHead(&lostnodes->children,(struct Node *)(parent=MakeNode(pardev,NULL)));
parent->parent = lostnodes;
}
if (!(nn = FindNode(&Names,name)))
nn = MakeNode(name,path);
else {
Remove((struct Node *)nn);
if (nn->path) FreeStr(nn->path);
nn->path = CopyStr(path);
}
AddHead(&parent->children,(struct Node *)nn);
}
/* This function reads in the individual file's data and builds entries
in the name list based on that data. */
void AddFIB(struct FileInfoBlock *fib,char *name) {
BPTR file;
char *buf,*com,*path;
if (buf = AllocMem(fib->fib_Size+1,0L)) {
if (file = Open(name,MODE_OLDFILE)) {
Read(file,buf,fib->fib_Size);
buf[fib->fib_Size] = '\0';
com = strtok(strupr(buf)," :\t\n");
path = strtok(NULL," \t\n");
while (com && path) {
DefNode(com,path);
com = strtok(NULL," :\t\n");
path = strtok(NULL," \t\n");
}
Close(file);
}
FreeMem(buf,fib->fib_Size+1);
}
}
/* ====================================================================== */
/* This function opens up the stuff we need. */
BOOL DoInits(void) {
if (!(DosBase = (struct DosLibrary *)OpenLibrary("dos.library",33L)))
return FALSE;
if (!(info = (struct DosInfo *)BADDR(((struct RootNode *)DosBase->dl_Root)->rn_Info)))
return FALSE;
if (!(fileinfo = AllocMem(sizeof(struct FileInfoBlock),MEMF_PUBLIC)))
return FALSE;
return TRUE;
}
/* This function cleans up after DoInits. */
void CloseUp(int code, char *str) {
if (str) printf("Error: %s\n",str);
if (fileinfo) FreeMem(fileinfo,sizeof(struct FileInfoBlock));
if (namelock) UnLock(namelock);
if (DosBase) CloseLibrary((struct Library *)DosBase);
exit(code);
}
/* ====================================================================== */
/* This function finds a directory node. It has the side effect of
setting "lastdev" to the last device in the global device list. */
struct DeviceList *AllocDirNode(char *name) {
struct DeviceList *dev, *newdev;
char *str,old[64];
/* Let's see if the assignment has already been made... */
for (dev = (struct DeviceList *)BADDR(info->di_DevInfo); dev != NULL;
dev = (struct DeviceList *)BADDR(dev->dl_Next)) {
lastdev = dev;
if (dev->dl_Type != DLT_DIRECTORY) continue;
b2cstr(old,dev->dl_Name);
if (!stricmp(old,name)) return dev;
}
/* Create the new name structure */
if (!(newdev=DOSAlloc(sizeof(struct DeviceList))) || !(str=DOSAlloc(32L))) {
if (newdev) DOSFree(newdev);
return NULL;
}
newdev->dl_Type = DLT_DIRECTORY;
strcpy(str+1,name);
str[0] = strlen(name);
newdev->dl_Name = CADDR(str);
return newdev;
}
/* This function does the "Assign" operation. */
BOOL Assign(char *name, char *path) {
BPTR block;
struct DeviceList *newdev;
/* Let's verify that the path object is really there. If not, try to make
the thing. */
if (!(block = Lock(path,SHARED_LOCK))) {
if (!(block = CreateDir(path))) return FALSE;
UnLock(block);
if (!(block = Lock(path,SHARED_LOCK))) return FALSE;
}
/* Get a node for this assignment. */
Forbid();
newdev = AllocDirNode(name);
/* Make the assignment */
if (newdev->dl_Lock) {
Permit();
UnLock(newdev->dl_Lock);
newdev->dl_Lock = block;
newdev->dl_Task = ((struct FileLock *)BADDR(block))->fl_Task;
return TRUE;
}
newdev->dl_Lock = block;
newdev->dl_Task = ((struct FileLock *)BADDR(block))->fl_Task;
/* Now link it into the device list. */
newdev->dl_Next = lastdev->dl_Next;
lastdev->dl_Next = CADDR(newdev);
Permit();
return TRUE;
}
/* This list takes in a node list, and performs assignments for all non-primary
nodes in the list, as long as "inhibit" is FALSE. */
void AssignList(struct List *lst, int level, BOOL inhibit) {
struct Node *n;
struct NameNode *nn;
for (n = lst->lh_Head; n->ln_Succ; n = n->ln_Succ) {
nn = (struct NameNode *)n;
if (nn->path) {
if (!inhibit) Assign(nn->node.ln_Name,nn->path);
if (verbose || inhibit)
printf("%*s%-15s%*s%s\2330m\n",level+1,"\23333m",nn->node.ln_Name,
14-level,"\23332m",nn->path);
}
if (nn->children.lh_Head->ln_Succ)
AssignList(&nn->children,level+2,inhibit);
}
}
/* ====================================================================== */
void main(int argc, char *argv[]) {
char path[256];
long i;
struct NameNode *nn;
struct DeviceList *dev;
if (!DoInits()) CloseUp(5,NULL);
/* Check the command line. */
for (i = 1; i < argc; ++i)
switch (toupper(argv[i][0])) {
case 'S':
Assign("SYS",argv[++i]);
break;
case 'V':
verbose = TRUE;
break;
case 'T':
test = TRUE;
verbose = TRUE;
break;
case '?':
printf("\2337mBindNames V1.0 by Dave Haynie\2330m\n\n");
printf("Usage: %s [VERBOSE] [TEST] [SYSTEM drive]\n",argv[0]);
CloseUp(0,NULL);
}
if (verbose) printf("\2337mBindNames V1.0 by Dave Haynie\2330m\n\n");
/* Let's build the internal device list. We know this list is going to be
a flat list; everything is primary, and thus hung from the root list. */
NewList(&Names);
Forbid();
for (dev = (struct DeviceList *)BADDR(info->di_DevInfo); dev != NULL;
dev = (struct DeviceList *)BADDR(dev->dl_Next)) {
if (!(nn = MakeNode(strupr(b2cstr(path,dev->dl_Name)),NULL))) continue;
AddHead(&Names,(struct Node *)nn);
}
Permit();
/* I need to build the "lostnodes" node. In order to avoid name collisions,
I make the name of this node '\0'. We never need to search for it by
name... */
AddTail(&Names,(struct Node *)(lostnodes = MakeNode("\0",NULL)));
/* Here I build the list of required assignments by walking through the
SYS:Names directory, and reading each file. */
if ((namelock = Lock(NAMEDIR,SHARED_LOCK))) {
Examine(namelock,fileinfo);
while (ExNext(namelock,fileinfo) || IoErr() != ERROR_NO_MORE_ENTRIES) {
if (fileinfo->fib_DirEntryType > 0) continue;
strcat(strcat(strcpy(path,NAMEDIR),"/"),fileinfo->fib_FileName);
AddFIB(fileinfo,path);
}
}
/* Now I've got everything; let's see what's actually here. */
Remove((struct Node *)lostnodes);
if (verbose) printf("Assigned Names:\n");
AssignList(&Names,1,test);
if (lostnodes->children.lh_Head->ln_Succ) {
if (verbose) printf("\n");
printf("Warning: Can't Resolve Names:\n");
AssignList(&lostnodes->children,1,TRUE);
}
CloseUp(0,NULL);
}
SHAR_EOF
cat << \SHAR_EOF > BindNames.uu
begin 644 BindNames
M```#\P`````````#``````````(```@@`````````64```/I```(("1()`!)V
M^0````!'^0```PAR`"`\````HV`")L%1R/_\+'@`!"E.`T`I3P-(0JP#1"9N`
M`11P`"(\```P`$ZN_LXI:P"8`SQ*JP"L9P``<"`/D*\`!`:`````@"E``PQA/
M``$N(&L`K-'(T<@B:``0T\G3R2`"<@`2&2E)`U#0@5*`0F=2@`)`__Z?P%6`_
M0G<(`"`"4X#4@1^R```@`%."4<C_]A^\`"`@`%."'[$@`"``4<K_^")/+PE@Z
M``!X*6L`.@,,<']2@-&L`PQA``#"0>L`7$ZN_H!!ZP!<3J[^C"E``T0O`"1`8
M("H`)&<2+&P%A"!`(B@``"E!`SQ.KO^"(BH`(&<:)#P```/M3J[_XBE``TQG1
M"N6(($`G:``(`*0@;`-$+PA(;`,((&@`)"EH``0#4$ZZ"(1.NAX@<`!@!"`OL
M``0O`"`L`S1G!"!`3I!.NAX`+'@`!")L!81.KOYB3KH(6DJL`T1G&B(L`TQG,
M!$ZN_]PL>``$3J[_?")L`T1.KOZ&(!\N;`-(3G5P9&"T0_H`$'``3J[]V"E`5
M!81G[$YU9&]S+FQI8G)A<GD`3E7_]"\**T#_^.6`(D!%Z0`!$A%(@4C!+T``3
M!"M(__P@`2)*3KH3LB!O``00$$B`(&W__$(P```@""1?3EU.=4Y5__@O#BM`<
M__Q8@"]```0B/``!``$L>``$3J[_.B!`(*\`!$/H``0@"2Q?3EU.=4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H`!&<&(FH`!"*+)4L`+
M!$JL`2QF!"E+`2Q!ZP`,(`A,WTR`3G4```````````````````/L`````@``]
M``(````,````!@````````/R```#Z0````````/R```#Z@```,(`````````9
M`````````````````"`Z"0H``"`)"@`@.@D*```@"0H`9&]S+FQI8G)A<GD`I
M17)R;W(Z("5S"@``)2IS)2TQ-7,E*G,E<YLP;0H`FS,S;0``FS,R;0``4UE3I
M`)LW;4)I;F1.86UE<R!6,2XP(&)Y($1A=F4@2&%Y;FEEFS!M"@H`57-A9V4Z)
M("5S(%M615)"3U-%72!;5$535%T@6U-94U1%32!D<FEV95T*``";-VU":6YD[
M3F%M97,@5C$N,"!B>2!$879E($AA>6YI99LP;0H*````4UE3.DYA;65S`%-9W
M4SI.86UE<P`O`$%S<VEG;F5D($YA;65S.@H```H`5V%R;FEN9SH@0V%N)W0@]
M4F5S;VQV92!.86UE<SH*`````````"@`````````````````````````````@
M`6(```````````````````````````````````````````&$````````````H
M`````````````````````````````````````````````````````````````
M``````````````````"`````!`#__P````X`#@```````!X2`````/__````,
M!``$``````````````&P__\````$``0````````>+@````#__P````0`!```1
M`````!XX```````@("`@("`@("`H*"@H*"`@("`@("`@("`@("`@("`@($@06
M$!`0$!`0$!`0$!`0$!"$A(2$A(2$A(2$$!`0$!`0$(&!@8&!@0$!`0$!`0$!&
M`0$!`0$!`0$!`0$!$!`0$!`0@H*"@H*"`@("`@("`@("`@("`@("`@("`@(0P
M$!`0("`@("`@("`@("@H*"@H("`@("`@("`@("`@("`@("`@2!`0$!`0$!`0`
M$!`0$!`0$(2$A(2$A(2$A(00$!`0$!`0@8&!@8&!`0$!`0$!`0$!`0$!`0$!=
M`0$!`0$0$!`0$!""@H*"@H("`@("`@("`@("`@("`@("`@("`A`0$!`@````Y
M```"`````^P````#`````````?@```'D```!O`````,````"```!U````6(`,
+``%``````````_(#Y
``
end
size 9236
SHAR_EOF
cat << \SHAR_EOF > Makefile
# Really cheap Makefile for BindNames.c
BindNames: BindNames.c
lc -Lt -O -rr -ms -v BindNames
SHAR_EOF
cat << \SHAR_EOF > ReadMe
BindNames V1.0 by Dave Haynie
BindNames is a rather simple hack I came up with to solve the
"Assign" problem. Like most folks with large hard disks containing lots
of different programs, my Startup-Sequence was starting to get full of
Assign statements. While that alone isn't necessarily enough to make
most go out and write a program, I was starting to think of this as an
inelegance. Nearly every other new program I installed onto my system
needed a new set of logical names, and so for every new program I ended
up having to edit my Startup-Sequence. I also had to pay attention to
the ordering of Assignments, since obviously I couldn't base an
assignment on one that hadn't been made yet. The end result was that
the Startup Sequence was getting rather ugly, with no sign of change on
the immediate horizon.
Since problems should be solved by those who see them, I came up
with BindNames. BindNames is designed to do all of the logical name
assignments you need at once. It looks for any number of files in the
directory "SYS:Names". The format of such files is something like this
(to quote my "SYS:Names/System" file):
BIN: SYS:bin
OS: SYS:os
C: BIN:c
COM: BIN:Com
L: OS:L
FONTS: PATH:FD:Amiga,FD:PD,FD:PS,FD:Terms,FD:CityDesk
FD: OS:Fonts
S: OS:s
DEVS: OS:Devs
LIBS: OS:Libs
ENV: RAM:Env
T: RAM:T
BindNames will read all name files before making any
assignments, and it can figure out dependencies, so it doesn't matter
how you order the names. It will create directories that it can't find,
such as RAM:Env and RAM:T in the above example, and it will generate
warnings for name assignments that it can't resolve. It also accepts
several options, of the form:
BindNames [SYSTEM device] [VERBOSE] [TEST]
The SYSTEM device option causes BindNames to re-assign the SYS:
name to the given device before searching for SYS:Names. For example,
my main system disk is called FH0:, but I boot from DH2: (sure sounds
like A2090A madness to me too, but what can I say), so my
Startup-Sequence says "BindNames >NIL: SYSTEM fh0:".
The VERBOSE switch causes BindNames to list each name and equivalence
as it runs. The TEST switch does the same thing, but doesn't actually
make the name assignments.
Using BindNames, I've managed to get every single "Assign"
command out of my Startup-Sequence. And if I need to add a series of
assignments for a new program, I can just create a SYS:Names file for
that program. That makes installing the program much easier, and also
keeps all the logical names for a particular program in an obvious
location, which makes modifying the system setup much simpler in the
future.
BindNames is public domain, do with as you please.
-Dave Haynie
3/14/89
SHAR_EOF
# End of shell archive
exit 0
--
Bob Page, U of Lowell CS Dept. page@swan.ulowell.edu ulowell!page
Have five nice days.